package com.kloooong.top.customer;


import com.alibaba.fastjson.JSONObject;
import com.kloooong.top.channel.UserVipChannel;
import com.kloooong.top.channel.UserVipInput;
import com.kloooong.top.message.UserVipMember;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Component;

@Component
@EnableBinding(UserVipInput.class)
public class UserVipCustomer {

    @StreamListener(target = UserVipInput.INPUT ,condition = "headers['headerId']=='123' and headers['action']=='user' ")
    public void userVip(UserVipMember userVipMember) {
        System.out.println("queue data is coming 。。。");
        System.out.println("data："+JSONObject.toJSONString(userVipMember));
    }


    @StreamListener(target = UserVipInput.INPUT ,condition = "headers['headerId']=='1234' and headers['action']=='user' ")
    public void userVip1(UserVipMember userVipMember) {
        System.out.println("queue data is coming 。。。");
        System.out.println("data："+JSONObject.toJSONString(userVipMember));
    }

}
